#!/bin/bash

id="$(id -u)"

if systemctl --user -q is-active xpra-shadow-"$id".scope; then
	echo "Stopping already running XPRA shadow server"
	systemctl stop xpra-shadow-"$id".scope
fi

xpra \
	--bind=/tmp/xpra-shadow.socket \
	--systemd-run=yes \
	--systemd-run-args="--unit=xpra-shadow-${id}" \
	--daemon=no \
	shadow
